<?php

namespace app\index\controller;

use think\Controller;

class Btc extends Controller
{
    public function index()
    {
        return view('btc/index');
    }

    public function getPrices()
    {
        $url = 'https://blockchain.info/ticker';
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        // 设定为不验证证书和host
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        $data = curl_exec($curl);
        curl_close($curl);

        echo $data;
    }
}
